//
//  UIView+BezierExtension.m
//  RiceBasket
//
//  Created by DwZeng on 2022/1/16.
//

#import "UIView+BezierExtension.h"

@implementation UIView (BezierExtension)

/**
 参数：
 
 rect        :  被传入View的bounds
 corners     :  圆角的位置（枚举值：左上、左下、右上、右下，可用“|”符号组合使用）
 UIRectCornerTopLeft  |  UIRectCornerTopRight  |  UIRectCornerBottomLeft  |  UIRectCornerBottomRight
 cornerRadii :  圆角大小（CGSize）
 */
- (void)rb_roundViewWithCorners:(UIRectCorner)rectCorner
                    cornerRadii:(CGSize)cornerRadii{
    UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:rectCorner cornerRadii:cornerRadii];
    CAShapeLayer *layer = [[CAShapeLayer alloc] init];
    layer.frame = self.bounds;
    layer.path = path.CGPath;
    self.layer.mask = layer;
}

@end
